package edu.spec.teacher.dao.impl;

import edu.spec.sys.model.enumeration.Status;
import edu.spec.teacher.dao.iface.IUserElectDao;
import edu.spec.teacher.model.UserElect;
import org.madgecko.basic.dao.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Author       : MadFrog
 * Date         : 2018/10/15 10:49
 * Description  :
 */
@Repository
public class UserElectDao extends BaseDao<UserElect> implements IUserElectDao {

    @Override
    public List<UserElect> listEffectiveByUser(Integer userId) {
        String hql = "from UserElect ue where ue.user.id=" + userId + " and ue.elect.status=" + Status.ENABLED.ordinal();
        return this.list(hql);
    }

}
